package com.ruoyi.fly.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.PageDomain;
import com.ruoyi.fly.domain.CeresStoreJoin;
import com.ruoyi.fly.domain.vo.CeresStoreJoinVo;
import com.ruoyi.fly.domain.vo.StoreJoinSearchVo;
import com.ruoyi.fly.service.ICeresStoreJoinService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 【请填写功能名称】Controller
 * 
 * @author ruoyi
 * @date 2024-05-11
 */
@RestController
@RequestMapping("/store/join")
@Api(tags = "店铺审核管理")
public class CeresStoreJoinController extends BaseController
{
    @Autowired
    private ICeresStoreJoinService ceresStoreJoinService;

    /**
     * 查询【请填写功能名称】列表
     */
    @ApiOperation(value = "查询店铺审核列表")
    @PostMapping("/selStoreList")
    public TableDataInfo list(@RequestBody StoreJoinSearchVo storeJoinSearchVo)
    {
        //startPage无效，添加新分页
        PageDomain pageDomain = new PageDomain();
        BeanUtils.copyProperties(storeJoinSearchVo,pageDomain);
        startPage(pageDomain);
        List<CeresStoreJoinVo> list = ceresStoreJoinService.selectCeresStoreJoinList(storeJoinSearchVo);
        return getDataTable(list);
    }

    /**
     * 修改【请填写功能名称】
     */
    @ApiOperation(value = "修改店铺审核")
    @PostMapping
    public R edit(@RequestBody CeresStoreJoin ceresStoreJoin)
    {
        return ceresStoreJoinService.updateCeresStoreJoin(ceresStoreJoin);
    }

    @GetMapping(value = "selStore/{id}")
    public R getInfo(@PathVariable("id") Long id)
    {
        CeresStoreJoin ceresStoreJoin = ceresStoreJoinService.selectCeresStoreJoinById(id);
        if (ceresStoreJoin == null){
            return R.fail("无数据");
        }
        return R.ok(ceresStoreJoin);
    }

}
